<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            background-color: #222;
        }
        #container{
            width: 300px;
            padding-top: 10vw;
            margin: 0 auto;
            margin-top: 2em;
            color: #fff;
            text-align: center;
            position: relative;
        }

        #round{
            width: 20px;
            height: 20px;
            border-radius: 50%;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            background-color: green;
        }

        #button{
            margin-top: 2em;
            border: 3px solid #000;
            border-radius: 4px;
        }

        #open, #close{
            width: 100px;
            height: 50px;
            border: none;
            cursor: pointer;
        }

        .active {
            color: green;
        }
    </style>
</head>
<body>
    <div id="container">
        <div id="round"></div>
        <div id="button">
            <button id="open" class="active">open</button>
            <button id="close">close</button>
        </div>
    </div>
</body>
</html>

<script>
    var round = document.getElementById('round');
    var open = document.getElementById('open');
    var close = document.getElementById('close');

    open.onclick = function(){
        round.style.backgroundColor = 'green';
        open.classList.add('active');
        close.classList.remove('active');
    }

    close.onclick = function(){
        round.style.backgroundColor = 'red';
        close.classList.add('active');
        open.classList.remove('active');
    }


    open.click();
</script>